#include <stdio.h>
//顺序表的插入和删除第二种方式

#define MaxSize 50
typedef int ElemType;//让顺序表存储其他类型元素时，可以快速完成代码修改
typedef struct {
    ElemType data[MaxSize];
    int len;//顺序表长度
} SqList;

void PrintList(SqList L) {
    for (int i = 0; i < L.len; i++) {
        printf("%3d", L.data[i]);
    }
}

void InsertList(SqList &L, int pos, ElemType element) {
    //默认插入到第二个位置

    for (int i = L.len - 1; i >= pos; i--) {
        L.data[i] = L.data[i - 1];
    }
    L.data[pos - 1] = element;
}

bool DeleteList(SqList &L, int pos) {

    if (pos < 1 || pos > L.len) {
        return false;
    }
    //给的删除的位置会默认+1
    for (int i = pos - 1; i < L.len; i++) {
        L.data[i] = L.data[i + 1];
    }
    L.len--;
    return true;

}

int main() {
    SqList L;
    int ret, delpos;
    L.len = 4;
    for (int i = 0; i < L.len - 1; i++) {
        L.data[i] = i + 1;
    }
    int num;
    scanf("%d\n%d", &num, &delpos);
    InsertList(L, 2, num);
    PrintList(L);
    printf("\n");
    ret = DeleteList(L, delpos);
    if (ret) {
        PrintList(L);
    } else {
        puts("false");
    }
    return 0;
}
